package com.landon.id.api;

import com.landon.id.generator.IdGeneratorApi;
import com.landon.id.generator.model.SegmentIdDO;
import com.landon.id.manager.CosIdManager;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author shishaopeng
 * Date: 2022-10-25-16-41
 * Desc: 作为服务的实现类
 */
@Service
public class IdGeneratorApiServiceImpl implements IdGeneratorApi {

    @Resource
    private CosIdManager cosIdManager;

    @Override
    public SegmentIdDO generateSegmentId(String businessId, Long segmentCount) {
        return cosIdManager.getSegment(businessId, segmentCount);
    }
}
